package cn.edu.gzmtu.utils;

import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;

/**
 * 用来进行密码加密的类
 */
public class BCryptPasswordEncoderUtils {

    private static BCryptPasswordEncoder bCryptPasswordEncoder = new BCryptPasswordEncoder();

    /**
     * 密码加密
     *
     * @param password
     * @return
     */
    public static String encodePassword(String password) {

        return bCryptPasswordEncoder.encode(password);
    }

    public static void main(String[] args) {
        String str = "xu123";
        // str = $2a$10$n8Yh.Vb7WM4DjOgzlTstvejiY0uv.EcaYeFC8TxT7H2WHvGc11rLW
        System.out.println("str = " + encodePassword(str));
    }
}
